import ProxyInterface from '../proxy-interface';
import { AddinListModel, AddinMainBarItemModel } from '../model/addins';

class AddinsListProxy implements ProxyInterface<AddinListModel> {
  private addins = new AddinListModel();

  constructor (responseData) {
    let data = responseData.data || responseData;
    Object.assign<AddinListModel, any>(this.addins, data)
  }

  getModel (): AddinListModel {
    return this.addins;
  }
}

class AddinsProxy implements ProxyInterface<AddinMainBarItemModel> {
  private addins = new AddinMainBarItemModel();

  constructor (responseData) {
    let data = responseData.data || responseData;
    Object.assign<AddinMainBarItemModel, any>(this.addins, data);
  }

  getModel (): AddinMainBarItemModel {
    return this.addins;
  }
}

export {
  AddinsListProxy,
  AddinsProxy
};
